<?php
/**
 * Created by PhpStorm.
 * User: xuewl
 * Date: 2017/12/24
 * Time: 22:10
 */
namespace app\notification\service;
use app\common\library\Service;

class Notification extends Service
{
    public function _initialize() {
        parent::_initialize();
    }

    public function make($key, $replace) {
        \think\Lang::load(APP_PATH . 'notification/lang/zh-cn.php');
        $lang = \think\Lang::get('notification');
        $string = $lang[$key];
        if(!$string) return false;

        $result = [];
        foreach ($string as $k => $v) {
            $result[$k] = str_replace(array_keys($replace), $replace, $value);
        }
        return $result;
    }

}